import { toString } from './base'

export const isDef = <T = any>(v?: any): v is T => {
	return typeof v !== 'undefined'
}

export const isFunction = <T extends Function>(
	v: any
): v is T => {
	return typeof v === 'function'
}

export const isBoolean = (v: any): v is boolean => {
	return typeof v === 'boolean'
}

export const isString = (v: any): v is string => {
	return typeof v === 'string'
}
export const isNumber = (v: any): v is number => {
	return typeof v === 'number'
}

export const isObject = (v: any): v is Object => {
	return toString(v) === '[object Object]'
}
